import { reqDetailData } from '@/api/detail/detail'
const state = {
    categoryView: {},
    price: 0,
    skuInfo: {
        skuImageList: [
            {
                imgUrl: ''
            }
        ]
    },
    spuSaleAttrList: [],
    valuesSkuJson: ''
}

const actions = {
    async getDetailData({ commit }, skuId) {
        const res = await reqDetailData(skuId)
        commit('GETDETAILDATA', res)
    }
}

const mutations = {
    GETDETAILDATA(state, res) {
        // console.log(res)
        state.categoryView = res.categoryView
        state.price = res.price
        state.skuInfo = res.skuInfo
        state.spuSaleAttrList = res.spuSaleAttrList
        state.valuesSkuJson = res.valuesSkuJson
    },
}
export default {
    namespaced: true,
    state,
    actions,
    mutations
}